import json

from service.DataCenter import db
from service.utils.transform import list_to_vtk_float_array
import uuid


def attribute_get(service, attribute):
    if service.app.actorList.size() == 0:
        return []
    ac = service.app.actorList.getValue(0)
    oss_path = "data/" + str(uuid.uuid4()) + ".json"
    if hasattr(ac, "is_standard_actor"):
        attr = ac.attributes[attribute]
        db.S3.upload_json(oss_path, json.dumps(attr))
        return db.S3.endpoint_url + "/d3-engine/" + oss_path
        return ""
    else:
        attr = ac.attributes[attribute]
        print(attr)
